<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <th:block th:include="include/include :: header('选择角色')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
<!--            <div class="col-sm-12 search-collapse">-->
<!--                <form id="formId">-->
<!--                    <div class="select-list">-->
<!--                        <ul>-->
<!--                            <li>-->
<!--                                <label>消息类型：</label>-->
<!--                                <select name="msgType" th:with="type=${@dict.getType('message_type')}">-->
<!--                                    <option value="">所有</option>-->
<!--                                    <option th:each="dict : ${type}" th:text="${dict.label}" th:value="${dict.value}"></option>-->
<!--                                </select>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>消息标题：</label>-->
<!--                                <input type="text" name="msgTitle"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
<!--                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
<!--                            </li>-->
<!--                        </ul>-->
<!--                    </div>-->
<!--                </form>-->
<!--            </div>-->
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include/include :: footer" />
    <script th:inline="javascript">
        var roleIds;
        function initData(initData) {
            roleIds = initData
            initTable()
        }
        function initTable() {
            var options = {
                url: ctx + 'admin/role/page',
                columns: [{
                    checkbox: true,
                    formatter: function(value, row, index) {
                        if(roleIds.indexOf(row.roleId) >= 0) {
                            return {
                                checked: true
                            }
                        }
                    }
                },
                    {
                        field: 'roleName',
                        title: '角色名称'
                    },
                    {
                        field: 'roleCode',
                        title: '角色标识'
                    }]
            };
            $.table.init(options);
        }
    </script>

</body>
</html>